package com.loyal.loyalerp.basedata.permission.mapper.provider;

public class GyPermissionProvider {
	public String listPermission(String sidx,String sord) {
		return "select * from gy_permission order by "+sidx+" "+sord;
		/*
		return "SELECT p.id,s.SystemName,p.permissionCode,p.permissionName,p.entityCode,p.entityName,a.ActionName " + 
				"FROM (gy_permission p INNER JOIN gy_system s ON p.systemCode=s.SystemCode) " + 
				"INNER JOIN gy_action a ON p.actionCode=a.ActionCode order by "+sidx+" "+sord;
	*/
	}
	
	public String listByActionCode(String actioncode) {
		return "select * from gy_permission where actioncode like CONCAT(CONCAT(\'%\',\'"+actioncode+"\',\'%\'))";
	}
	
	public String findPermission(String searchField,String searchString) {
		return "select * from gy_permission where "+searchField+" like CONCAT(CONCAT(\'%\',\'"+searchString+"\',\'%\'))";
	}
	
	public String deletePermissionByActionCode(String actionCode) {
		return "delete from gy_permission where actionCode='"+actionCode+"'";
	}
	
	public String deletePermissionBySystemCode(String systemCode) {
		return "delete from gy_permission where systemCode='"+systemCode+"'";
	}
	
	//根据permissionCode查到entityCode和actionCode
	public String selectECAndACByPermissionCode(String permissionCode) {
		return "select * from gy_permission where permissionCode='"+permissionCode+"'";
	}
	
}
